package banking;


class Fish{
 int weight;
}
class Lake{
 Fish fish;
 void setFish(Fish s){
  fish = s;
 }
 void eat(int n){
  fish.weight = fish.weight + n;
 }
}
class FishandLake{
 public static void main(String[] args) {
  Fish niqiu = new Fish();
  System.out.println(niqiu.weight);//输出1:泥鳅的初始体重
  Lake qiandaohu  = new Lake();
  Lake kanas=new Lake();
  Lake napa=new Lake();
  Lake bailonghu=new Lake();//实例化多个Lake对象
  qiandaohu.setFish(niqiu);
  qiandaohu.eat(3);
  System.out.println(niqiu.weight);//输出2：输出泥鳅的体重
  System.out.println(qiandaohu.fish.weight);//输出3：通过调用输出太湖中的鱼的体重并验证
  kanas.setFish(niqiu);
  kanas.eat(4);
  System.out.println(niqiu.weight);//输出4：输出泥鳅的体重
  System.out.println(kanas.fish.weight);//输出5：通过调用输出青海中的鱼的体重并验证
  napa.setFish(niqiu);
  napa.eat(9);
  System.out.println(niqiu.weight);//输出6：输出泥鳅的体重
  System.out.println(napa.fish.weight);//输出7：通过调用输出潘阳湖中的鱼的体重并验证
  bailonghu.setFish(niqiu);
  bailonghu.eat(6);
  System.out.println(niqiu.weight);//输出8：输出泥鳅的体重
  System.out.println(bailonghu.fish.weight);//输出9：通过调用输出洞庭湖中的鱼的体重并验证
 }
}
